###
###     Makefile for AVS decoder (ipp based version)
###
###     generated for UNIX/LINUX environments
###             by Henry Dong
###


APP= ippjpeg

### include debug information: 1=yes, 0=no
#DBG= 0

DEPEND= dependencies

BINDIR= bin
OBJDIR= obj

##INCDIR= ./app ./ipp/_include ./ijx/_include
INCDIR=./include
SRCDIR= ./src

#CC=     $(shell which gcc)
#CC  =  $(BUILD_ROOT)/i686-cm-linux-gcc
#AS  =  $(BUILD_ROOT)/i686-cm-linux-as
#LIB =  $(BUILD_ROOT)/i686-cm-linux-ld -r
CC  =  gcc
AS  =  as
LIB =  ld -r


LIBS= -lm

CFLAGS= -std=gnu99 -pedantic -ffloat-store -fno-strict-aliasing
FLAGS=  $(CFLAGS) -Wall -I$(INCDIR) -D __USE_LARGEFILE64 -D _FILE_OFFSET_BITS=64  -D IPPJPVER=1

ifdef DBG
SUFFIX= .dbg
FLAGS+= -g
else
SUFFIX=
FLAGS+= -O3
endif

OBJSUF= .o$(SUFFIX)

SRC=    $(wildcard $(SRCDIR)/*.c) 
OBJ=    $(SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o$(SUFFIX)) 
BIN=    $(BINDIR)/$(APP)$(SUFFIX).exe


default: depend bin tags

dependencies:
	@echo "" >dependencies

clean:
	@echo remove all objects
	@rm -f $(OBJDIR)/* $(BIN)

tags:
	@echo update tag table
	@ctags include/*.h src/*.c

bin:    $(OBJ)
	@echo
	@echo 'creating binary "$(BIN)"'
	@$(CC) -o $(BIN) $(OBJ) 
	@echo '... done'
	@echo

depend:
	@echo
	@echo 'checking dependencies'
	@$(SHELL) -ec '$(CC) -MM $(CFLAGS) -I$(INCDIR) $(SRC)                  \
         | sed '\''s@\(.*\)\.o[ :]@$(OBJDIR)/\1.o$(SUFFIX):@g'\''               \
         >$(DEPEND)'
	@echo

$(OBJDIR)/%.o$(SUFFIX): $(SRCDIR)/%.c
	@echo 'compiling object file "$@" ...'
	@$(CC) -c -o $@ $(FLAGS) $<

include $(DEPEND)

